<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>工单查询-工单列表</title>
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/defalut.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/public.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/ddspstyle.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/icon.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/WdatePicker/skin/WdatePicker.css">
<script type="text/javascript" src="../../static/js/jquery.min.js"></script>
<script type="text/javascript" src="../../static/js/jquery.easyui.min.js"></script>
<script type="text/javascript"	src="../../static/js/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="../../static/js/jquery.validate.js"></script>
<script type="text/javascript" src="../../static/js/index.js"></script>
<script type="text/javascript" src="../../static/js/WdatePicker/WdatePicker.js"></script>
<script type="text/javascript" charset="utf-8" src="../../ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="../../ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="../../ueditor/lang/zh-cn/zh-cn.js"></script>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">

<script type="text/javascript">
	document.onkeydown = function(event) {
		var e = event || window.event || arguments.callee.caller.arguments[0];
		if (e && e.keyCode == 13) { // enter 键
			try {
				searchData();
			} catch (e) {
				gotoSearch($('#easyui-treegrid'));
			}
		}
	};
</script>
<style type="text/css">
.imgsw {
	background: url(../resource/images/a0133.png) no-repeat;
	height: 14px;
	width: 17px;
	display: inline-block;
	border: 0;
}
</style>
<script type="text/javascript">
		var queryParams;
		function EasyuiDatagrid(){
			$("#easyui-datagrid").datagrid({
				url: '../../work_order/work_order_list.do',
				nowrap: true,
				striped: true,
				border: false,
				fit: true,
				rownumbers:true,
				queryParams: getGueryParams(),
				columns: [[
					{field:'id',checkbox:true},
					{field:'f_wo_id',title:'工单ID',align:'center',width:50},
					{field:'f_wo_type',title:'工单业务分类',align:'center',formatter:function(value,row,index){
						if(value=="1"){
							return "itv分组申请";
						}else if(value=="2"){
							return "视频会议申请";
						}
					}},
					{field:'f_wo_projectName',title:'工单标题',align:'center',width:100},
					{field:'f_wo_cdate',title:'工单发起时间 ',align:'center',width:150,		
						formatter:function(value,row,index){
							if(value){
								return new Date(value).Format("yyyy-MM-dd hh:mm:ss");
							}else {
								return '';
							}
						}},
					{field:'f_wo_directorUser',title:'工单处理人',align:'center',width:100},
					{field:'f_wo_udate',title:'工单处理时间 ',align:'center',width:150,		
					formatter:function(value,row,index){
							if(value){
								return new Date(value).Format("yyyy-MM-dd hh:mm:ss");
							}else {
								return '';
							}
							
					
					}},
					{field:'f_wo_reviewRemarks',title:'处理意见',align:'center',width:100},
					
					{field:'f_wo_address',title:'地区',align:'center',width:100,formatter:function(value,row,index){
						if(value == undefined){
							return "";
						}else{
							var areaArr = value.split("-");
							return provice[11].city[0].districtAndCounty[areaArr[2]];
						}
					}},
					{field:'f_wo_status',title:'状态',align:'center',formatter:function(value,row,index){
						if(value=="1"){
							return "有效";
						}else if(value=="2"){
							return "无效";
						}else if (value=="4"){
							return "审核未通过";
						}
					}},
					{field:'_parentId',title:'操作',align:'center',width:180,
						formatter:function(value,row,index){
							str= '<a id="info" class="easyui-linkbutton l-btn l-btn-plain" plain="true" iconcls="icon-edit" href="javascript:void(0);" onclick="info(\''+row.f_wo_id+'\',\''+row.f_wo_type+'\');"><span class="l-btn-left"><span class="l-btn-text icon-edit l-btn-icon-left">详情</span></span></a>';
							str+= '<a id="edit" class="easyui-linkbutton l-btn l-btn-plain" plain="true" iconcls="icon-edit" href="javascript:void(0);" onclick="edit(\''+row.f_wo_id+'\',\''+row.f_wo_type+'\');"><span class="l-btn-left"><span class="l-btn-text icon-edit l-btn-icon-left">修改</span></span></a>';
							if(row.f_wo_status!=1 ) {
				    			str+='<a class="easyui-linkbutton l-btn l-btn-plain" iconCls="icon-ok" href="javascript:void(0);" plain="true" onclick="review(\''+row.f_wo_id+'\',\''+row.f_wo_type+'\');" ><span class="l-btn-left"><span class="l-btn-text icon-ok l-btn-icon-left">审核</span></span></a>';
				    		}
							return str;
				    	}
					}
				]],
				singleSelect:true,
				pagination: true,
		//		view: detailview,
				pageList: [10,20,30,40,50],
				pageSize:10,
				toolbar: '#toolbar',
			//	detailFormatter:function(index,row){
		//			return '<div class="ddv" style="padding:5px 0">111111</div>';
			//	},
				onExpandRow: function(index,row){
				
				},
				onSelect: function(rowIndex,rowData) {
					
				},
				onUnselect: function(rowIndex,rowData) {
					
				},
				onCheckAll: function(rowIndex,rowData) {
					
				},
				onUncheckAll: function(rowIndex,rowData) {
				
				},
				onLoadSuccess: function (data) {
					if(data.total==-1) {
						$.messager.defaults={ok:"确定",cancel:"取消"};
						$.messager.confirm('提示', '用户尚未登录,请登录', function(r){
							if (r){
							    window.parent.location.href='/cbweb';
							    return false;
							}
						});
					}
				}
			});
	    }
		
		function endOfSubmit(){
			closeDialog($("#dialogMoveBusiness"));
			closeDialog($("#dialogMenuEdit"));
			gotoSearch();
		}
		function getGueryParams(){
			$("#f_wo_address").val(getAddress());
			return {
				f_wo_projectName:$("#f_wo_projectName").val(),
				f_wo_status:$("#f_wo_status").val(),
				f_wo_address:$("#f_wo_address").val(),
				f_wo_startTime:$('input[name="f_wo_startTime"]').val(),
				f_wo_endTime:$('input:hidden[name="f_wo_endTime"]').val()
			};
		}
		$(function(){
			$("#prov").val(11);
			$("#city").val(0);
			showCountry(city);
			new EasyuiDatagrid();
			gotoSearch = function(){
				$("#easyui-datagrid").datagrid('reload',getGueryParams());
			};
		});
		function SubgridTabOnSelect(title,index){
			setTimeout(function(){
				$("#easyui-datagrid").datagrid('fixDetailRowHeight',index);
			},300);
			setTimeout(function(){
				$("#easyui-datagrid").datagrid('fixDetailRowHeight',index);
			},3000);
	    }
	 
		
		function load(){
			$(".datagrid-row-expander datagrid-row-expand").attr("display","none"); 
			 $(".datebox :text").attr("readonly","readonly");
		}
		
		function _resert(){
			$("#areacode").val("");
			$("#projectname").val("");
			$("#status").val("");
			$("#beginTime").datebox('setValue','');
			$("#endTime").datebox('setValue','');
		}
		
		function onpress(){
		var event=arguments.callee.caller.arguments[0]||window.event;//消除浏览器差异
   		  	if (event.keyCode == 13){  
      			gotoSearch($('#easyui-treegrid'));
    		}
		}
		
	
		function info(obj,obj2){
			var row = obj;
			var type = obj2;
			if(obj2=="null"){
				type = 0;
			}
			openDialog($("#dlg"),'workorder_info.jsp?f_wo_id='+row+'&f_wo_type='+type);
		}
		function edit(f_wo_id,f_wo_type){
			var row = f_wo_id;
			var type = f_wo_type;
			if(f_wo_type=="null"){
				type = 1;
			}
			openDialog($("#dlg"),'workorder_update.jsp?f_wo_id='+row+'&f_wo_type='+type);
		}
		$(function(){
			$("#search_shi_id").change(function(){
				$("#search_qu_id").empty();
				$("#search_qu_id").append("<option value=\"\">请选择</option>");
				var val = this.value;
				if(val==""){
					$("#areacode").val("");
				}else{
					$("#areacode").val(val);
				}
				if(val != ""){
					$.getJSON("/cbweb/area/sonArea.html",{code:val},function(result){
						$(result.object).each(function(){
							$("#search_qu_id").append("<option value=\""+this.code+"\">"+this.name+"</option>");
						});
					});
				}
			});
			$("#search_qu_id").change(function(){
				var val = this.value;
				if(val==""){
					val =$("#search_shi_id").val();
				}
				$("#areacode").val(val);
			});
		});
		function review(id,type) {
			openDialog($('#dlg'),'workorder_rev.jsp?f_wo_id='+id+'&f_wo_type='+type); 
		}
		function getAddress(){
			var prov = $("#prov").val();
			var city = $("#city").val();
			var country = $("#country").val();
			var str="";
			if(city == ""){
				str = "";
				//str = prov+"-";
			}else if(country == ""){
				str = "";
				//str = prov+"-"+city+"-";
			}else {
				str = prov+"-"+city+"-"+country;
			}
			return str;
		}
	</script>
  </head>
  <body onload="load();">
	<table id="easyui-datagrid" title="工单查询"></table>
	<div id="toolbar" class="easyui_datagrid_toolbar" style="">
		<div class="easyuiSearch">
			<form onsubmit="return false;" method="post">
				<table cellspacing="0" cellpadding="0" width="90%">
					<tr>
						<td align="right" width="15%">地区：</td>
						<td align="left">
						<!-- <select name="shenId" id="search_shen_id" style="width: 80px;" onkeydown="onpress();">
								<option value="">浙江省</option>
						</select> 
						<select name="shiId" id="search_shi_id" style="width: 80px;" onkeydown="onpress();">
								<option value="3301">杭州市</option>
						</select> 
						<select name="quId" id="search_qu_id" style="width: 80px;" onkeydown="onpress();">
								<option value="330101">杭州市市辖区</option>
								<option value="330102">上城区</option>
								<option value="330103">下城区</option>
								<option value="330104">江干区</option>
								<option value="330105">拱墅区</option>
								<option value="330106">西湖区</option>
								<option value="330108">滨江区</option>
								<option value="330109">萧山区</option>
								<option value="330110">余杭区</option>
								<option value="330122">桐庐县</option>
								<option value="330127">淳安县</option>
								<option value="330182">建德市</option>
								<option value="330183">富阳市</option>
								<option value="330185">临安市</option>
								<option value="" selected="selected">请选择</option>
						</select> -->
						<select id="prov" onfocus="this.defaultIndex=this.selectedIndedx;" onchange="this.selectedIndex=this.defaultIndex;" style="width: 80px;">
							                <option value="11">浙江省</option>
						</select>
						<select id="city" name="city" onchange="showCountry(this)" style="width: 80px;">
											<option value="">请选择</option>
						</select> 
						<select id="country" style="width: 80px;">
											<option value="">请选择</option>
						</select>
						</td>
						<input name="f_wo_address" id="f_wo_address" type="hidden" onkeydown="onpress();" />
						
						<td align="right" width="15%">发起时间：</td>
						<td align="left" width="35%">
							<input class="easyui-datebox" id="f_wo_startTime" name="f_wo_startTime" style="width: 100px;" onkeydown="onpress();" /> 
							--<input class="easyui-datebox" id="f_wo_endTime" name="f_wo_endTime" style="width: 100px;" onkeydown="onpress();" />
						</td>
					</tr>
					<tr>
						<td align="right">状态：</td>
						<td align="left" width="35%">
							<select name="f_wo_status" id="f_wo_status" style="width: 75px;" onkeydown="onpress();">
									<option value="0">请选择</option>
									<option value="1">有效</option>
									<option value="2">无效</option>
									<option value="4">审核未通过</option>
							</select>
						</td>
						<td align="right">项目名称：</td>
						<td align="left">
							<input name="f_wo_projectName" id="f_wo_projectName" style="width: 200px;" onkeydown="onpress();" />
						</td>
					</tr>
					<tr>
						<td colspan="4" align="center"><a href="javascript:void(0);" class="easyui-linkbutton"
							data-options="iconCls:'icon-search', plain:true"
							onclick="gotoSearch($('#easyui-datagrid'))">查询</a> 
							<!--		<a href="javascript:void(0);" class="easyui-linkbutton" data-options=" plain:true" onclick="_resert()">重置</a>-->
						</td>
					</tr>
				</table>
			</form>
		</div>
	</div>


	<div id="dlg" class="easyui-dialog" style="width: 900px; height: 700px; padding-top: 0px;"
		data-options="title: '工单详情', iconCls:'icon-save',modal:true,closed:true,buttons:'#dlg_buttons'">
		<iframe scrolling="auto" frameborder="0" style="width: 100%; height: 99%;"></iframe>
	</div>
	</body>
	<script type="text/javascript" src="../../static/js/city/city.js"></script>
<script type="text/javascript" src="../../static/js/city/method01.js"></script>
</html>